package com.jason.controller;

import com.jason.kafka.ProducerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SendController {

    @Autowired
    private ProducerService producer;

    @PostMapping("/send/{topic}")
    public Object send(@PathVariable("topic") String topic, @RequestBody String message){
        producer.send(topic,message);
        return "OK";
    }
}
